<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
</head>
<style>
    .layui-top-box {padding:40px 20px 20px 20px;color:#fff}
    .panel {margin-bottom:17px;background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
    .panel-body {padding:15px}
    .panel-title {margin-top:0;margin-bottom:0;font-size:14px;color:inherit}
    .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
    .layui-red {color:red}
    .main_btn > p {height:40px;}
    .panel-body {
        height: 150px!important;
    }
</style>
<body>

<h1 align="center">欢迎登录小陈许后台管理系统</h1>

<div class="layui-box">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <blockquote class="layui-elem-quote main_btn">
                <div id="dateTime"></div>
            </blockquote>
        </div>
    </div>
</div>

<div class="layuimini-main layui-top-box">
    <div class="layui-row layui-col-space10">

        <div class="layui-col-md4">
            <div class="col-xs-6 col-md-3">
                <div class="panel layui-bg-cyan">
                    <div class="panel-body">
                        <div class="panel-title">
                            <span class="label pull-right layui-bg-blue">实时</span>
                            <h2>商品种类总数</h2>
                        </div>
                        <div class="panel-content">
                            <h1 class="no-margins" id="sum1"></h1>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-col-md4">
            <div class="col-xs-6 col-md-3">
                <div class="panel layui-bg-blue">
                    <div class="panel-body">
                        <div class="panel-title">
                            <span class="label pull-right layui-bg-cyan">实时</span>
                            <h2>订单总数</h2>
                        </div>
                        <div class="panel-content">
                            <h1 class="no-margins" id="sum2"></h1>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-col-md4">
            <div class="col-xs-6 col-md-3">
                <div class="panel layui-bg-orange">
                    <div class="panel-body">
                        <div class="panel-title">
                            <span class="label pull-right layui-bg-green">实时</span>
                            <h2>已完成订单数</h2>
                        </div>
                        <div class="panel-content">
                            <h1 class="no-margins" id="sum3"></h1>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>






<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    $.ajax({
        url:"/show",
        type:"post",
        data:"json",
        success:function(res){
            document.getElementById("sum1").innerHTML = res.total;
            document.getElementById("sum2").innerHTML = res.all_ordertable;
            document.getElementById("sum3").innerHTML = res.finish;
        }
    })
    Date.prototype.format = function (fmt) {
        var o = {
            "y+": this.getFullYear, //年
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds() //秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }
    setInterval("document.getElementById('dateTime').innerHTML = (new Date()).format('yyyy-MM-dd hh:mm:ss');", 1000);
</script>
</body>
</html>